

window.onload = function () {
    render();
}

function render() {
    var jsonData = document.getElementById('j-data').innerHTML,
        tpl = document.getElementById('j-tpl').innerHTML,
        oList = document.getElementsByClassName('j-list')[0],
        data = JSON.parse(jsonData),
        dataLen = data.length,
        item, list = '';


    for (var i = 0; i < dataLen; i++) {
        item = data[i];
        list += setTplToHTML(tpl, regTpl, {
            career: item.career,
            city: item.city,
            salary: item.salary,
            img: item.img
        });
    }
    oList.innerHTML = list;
}


function regTpl() {
    return new RegExp(/{{(.*?)}}/, 'gim');
}
